Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.OracleClient

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class Service
     Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function PruebaWS(ByVal dato As String) As String
        Dim oradb As String = "Data Source=172.16.4.10;User Id=oracledba;Password=patal"
        Dim conn As New OracleConnection(oradb)
        Dim ds As New DataSet()
        conn.ConnectionString = oradb
        Try
            conn.Open()

            Dim cmd As New OracleCommand '  dato es = 3342009
            cmd.Connection = conn
            cmd.CommandText = "select getnombreubicacion(id_empresa, id_ubicacion) Tienda  from ORACLEDBA.transaccion_header where numero_documento ='" + dato + "'"
            cmd.CommandType = CommandType.Text

            Dim sda As New OracleDataAdapter(cmd)

            sda.Fill(ds)

            If Not IsNothing(ds) Then
                If ds.Tables.Count > 0 Then
                    If ds.Tables(0).Rows.Count > 0 Then
                        Return ds.Tables(0).Rows(0).Item("Tienda")
                    Else
                        Return "No existen resultados"
                    End If
                Else
                    Return "No existen resultados"
                End If
            Else
                Return "No existen resultados"
            End If
            conn.Close()
        Catch ex As Exception
            Return ex.Message()
        Finally
        End Try
    End Function

End Class
